package com.cs474.cupcakes7;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/* 
    cout << "Choose Recipe Options:" << endl;
    cout << "1. List recipes" << endl;
    cout << "2. Modify specific known recipe" << endl;
    cout << "3. Add new recipe" << endl;
    cout << "4. Delete recipe" << endl;
    cout << "5. Back to main menu" << endl;
 */

public class RecipesList extends ListActivity {
	private final int ADD_RECIPE = 0;
	
	@Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        //setContentView(R.layout.list);
        //Here we have to populate the list of recipes to choose from
        //we populate the list and 
        ListView lv = getListView();
  	  	lv.setTextFilterEnabled(true);
  	  	
  	  	String menuItems[] = {"No Recipes found. Choose menu to add"};

  	  	this.setListAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, menuItems));

    }
	// Set up the menu for the ingredients
	public boolean onCreateOptionsMenu(Menu menu) {
	        boolean supRetVal = super.onCreateOptionsMenu(menu);
	        menu.add(Menu.NONE, ADD_RECIPE, Menu.NONE, "Add Recipe");
	        //menu.add(Menu.NONE, 1, Menu.NONE, "Add Ingredient");
	    	//.setIcon(android.R.drawable.);
		return supRetVal;
	}
	
	public boolean onOptionsItemSelected(MenuItem item) {
		
	    switch (item.getItemId()) 
	    
	    {
	        case ADD_RECIPE:
	        	startActivity(new Intent(this, AddRecipe.class));
	    }
	    
	    
	    return false;
	}
	
	
}